<!DOCTYPE html>
<meta charset="utf-8" />
<link rel="stylesheet" href="ace_v1.3/assets/css/ui.jqgrid.css" />

<div class="search_panel">
<form action="" id="rechargeSearchForm" method="post" onsubmit="return pageSearch(this);">
	<div style="display: block;" class="widget-body ">
		<div class="widget-main">
			<div class="rowt">
				<div class="col-sm-12">
					<div>
					<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">订单号:</label>
							<div class="search_input">
								<input id="prdOrdNo" type="text" name="prdOrdNo" placeholder="请输入订单号">
							</div>
						</div>
					<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">商户编号:</label>
							<div class="search_input">
								<input id="custId" type="text" name="custId" placeholder="请输入商户编号">
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">商户名称:</label>
							<div class="search_input">
								<input id="custName" type="text" name="custName" placeholder="请输入商户名称">
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">商户订单号:</label>
							<div class="search_input">
								<input id="custOrderNo" type="text" name="custOrderNo"
									placeholder="请输入商户订单号">
							</div>
						</div>
						<!-- <div class="search_elm" style="margin-left: 0px">
							<label class="label_search">商户手机:</label>
							<div class="search_input">
								<input id="usrMobile" type="text" name="usrMobile"
									placeholder="请输入商户手机">
							</div>
						</div> -->
						<!-- <div class="search_elm" style="margin-left: 0px">
							<label class="label_search">合作商编号:</label>
							<div class="search_input">
								<input id="agentId" type="text" name="agentId" placeholder="请输入商户名称">
							</div>
						</div> -->
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">银行卡号:</label>
							<div class="search_input">
								<input id="bankpayacno" type="text" name="payCardNo" placeholder="请输入银行卡号">
							</div>
						</div>
						
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">大商户号:</label>
							<div class="search_input">
								<input id="TMERCID" type="text" name="TMERCID" placeholder="请输入大商户编号">
							</div>
						</div>
						
						<div class="search_elm" style="margin-left: 0px;width: 300px;">
							<label class="label_search">合作商名称:</label>
							<div class="search_input">
								 <select 
									 rel=""
									 location="mpamng/selectoption/agent.do" 
									 name="agentId" 
									 valName="agentId"
									 textName="agentName"
									 id="search_agentName" 
									 data="{'start':0,'pageSize':1000}"
									 data-placeholder="请选择合作商名称" style="width: 200px;vertical-align:middle;">
									<option value='' >----请选择----</option>
								 </select>
							</div>
						</div>
						
						<!-- <div class="search_elm" style="margin-left: 0px">
							<label class="label_search">开户行:</label>
							<div class="search_input">
								<input id="bankcode" type="text" name="bankcode" placeholder="请输入开户行">
							</div>
						</div> -->
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">订单状态:</label>
							<div class="search_input">
							<select 
								rel="obj.ORDSTATUS"
								location="local" 
								 name="ordStatus" 
								 id="search_paystatus" 
								  style="width: 120px;vertical-align:middle;">
								  <option value="">---选择---<option>
						 </select>
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">支付方式:</label>
							<div class="search_input">
								<select 
									rel="obj.PAYTYPE"
									location="local" 
									 name="payType" 
									 id="payType" 
									 style="width: 120px;vertical-align:middle;">
									 <option value="">---选择---<option>
							 	</select>
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">费率类型:</label>
							<div class="search_input">
								<select 
									rel="obj.RATETYPE"
									location="local" 
									 name="rateType" 
									 id="rateType" 
									 style="width: 120px;vertical-align:middle;">
									 <option value="">---选择---<option>
							 	</select>
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">支付渠道:</label>
							<div class="search_input">
								<select 
									rel="rows"
									location="mpcoop/coopManage/query.do" 
									name="payChannel" 
									id="payChannel" 
									valName="cooporgNo"
									textName="coopname"
									data="{'start':0,'pageSize':100}"
									style="width: 120px;vertical-align:middle;">
									 <option value="">---选择---</option>
								</select>
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px;margin-right: 15px;width: 360px;">
						    <label class="label_search" for="userName">订单时间:</label>
							<div class="input-group">
								<input type="text" class="form-control date-timepicker"  name="prdDateStart" data-date-format="YYYY-MM-DD HH:mm:ss" placeholder="起始日期" />
								<span class="input-group-addon">
									<i class="fa fa-exchange"></i>
								</span>
								<input type="text" class="form-control date-timepicker"  name="prdDateEnd" data-date-format="YYYY-MM-DD HH:mm:ss" placeholder="结束日期" />
							</div>

						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">结算状态:</label>
							<div class="search_input">
							<select 
								rel="obj.CASSTATUS"
								location="local" 
								 name="casStatus" 
								 id="casStatus" 
								 style="width: 120px;vertical-align:middle;">
								 <option value="">---选择---<option>
						 </select>
							</div>
						</div>
						
						<div class="search_elm" style="margin-left: 0px;">
						   <div class="checkbox" style="margin-top: 0px;">
								<label>
									<input name="containsSubset" value="1" class="ace ace-checkbox-2" type="checkbox">
									<span class="lbl">包含子合作商</span>
								</label>
							</div>
						</div>
						
						<div class="search_elm">
							<button class="btn btn-small btn_search" type="submit" title="搜索" onclick="searchCount();">
								搜索
							</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div style="display: block;" class="widget-body " id="total">
		
	</div>
	</form>
	
	
	<div class="row">
		<div class="col-xs-12">
			<table id="grid-table"></table>
			<div id="grid-pager"></div>
			
			<div style="margin-top: 10px">
				 <span id="paging_bar" style="float: right"> </span>
			</div>
			<span id="auth_btn">
				
				<!-- <a class='btn btn-small btn-warning'
					onclick="rechargeDetails();"> 详细
				</a> -->
				<a  class="btn btn-small btn-info"
					onclick="reportPrdOrdList();">导出数据文件
				</a>
				<a  class="btn btn-small btn-info"
					onclick="prdOrdSyn();">订单状态同步
				</a>
				<a  class="btn btn-small btn-info"
					onclick="noticeClient();">补发通知
				</a>
				<!-- <a  class="btn btn-small btn-warning"
					onclick="casByOrder();">申请出款
				</a> -->
				<a  class="btn btn-small btn-warning"
					onclick="refund();">调单退款
				</a>
				</span>
			 <span id="paging_bar" style="float: right"> </span>
			<!-- PAGE CONTENT ENDS -->
		</div>
		<!-- /.col -->
	</div>
	<!-- /.row -->
	
	 <!-- <script type="text/javascript" src="ace_v1.3/assets/js/date-time/moment-cn.js" charset="UTF-8"></script>
 -->
	<!-- page specific plugin scripts -->
	<script type="text/javascript">
	//初始化日期参数(-5:当前日期前5天)
	var stDate = addDate(getNowFormatDate(),-0);
	stDate = stDate + " 00:00:00";
	
	var endDate = getNowFormatDate();
	endDate = endDate + ' 23:59:59';
	
	var rowCount = null,sucCount = null;
	
	$('input[name="prdDateStart"]').val(stDate);
	$('input[name="prdDateEnd"]').val(endDate);
	var jqGrid;
	jQuery(function($) {
		var grid_selector = "#grid-table";
		var pager_selector = "#grid-pager";

		$(window).on(
				'resize.jqGrid',
				function() {
					$(grid_selector).jqGrid('setGridWidth',$(".page-content").width());
				})
		var parent_column = $(grid_selector).closest('[class*="col-"]');
		$(document).on(
				'settings.ace.jqGrid',
				function(ev, event_name, collapsed) {
					if (event_name === 'sidebar_collapsed'|| event_name === 'main_container_fixed') {
						setTimeout(function() {
							$(grid_selector).jqGrid('setGridWidth',parent_column.width());
						}, 0);
					}
				})
		jQuery(grid_selector).jqGrid({
			url : "mpomng/prdInf/rechargePrdList.do",
			datatype : "json",
			height : '100%',
			width : '100%',
			colNames : [ '订单号','商户编号  ','商户名称','订单时间','订单状态','记账状态','商户订单号','合作商编号','合作商名称','支付方式','终端号','费率类型','费率','订单金额','支付金额','手续费','入账金额','支付渠道','银行账号','银行名称','卡片名称','支付完成时间','结算状态','分润状态','第三方返回码','大商户编号','交易流水号','操作' ],
			colModel : [   {name : 'prdOrdNo',        index : 'prdOrdNo',        width : '140px',sortable:false,formatter:createDetailsBtn }, 
						     {name : 'custId',        index : 'custId',        width : '120px',sortable:false }, 
						     {name : 'custName',        index : 'custName',        width : '80px',sortable:false },
						     {name : 'ordTime',        index : 'ordTime',        width : '140px',sortable:false,formatter : gridFormatByDate },
						     {name : 'ordStatus',        index : 'ordStatus',        width : '100px',sortable:false ,ditcKey:'ORDSTATUS' ,formatter : gridFormatByDict },
						     {name : 'accStatus',        index : 'accStatus',        width : '80px',sortable:false ,ditcKey:'PRD_ACC_STATUS' ,formatter : gridFormatByDict },
						     {name : 'custOrderNo',        index : 'custOrderNo',        width : '140px',sortable:false }, 
						     {name : 'agentId',        index : 'agentId',        width : '100px',sortable:false }, 
						     {name : 'agentName',        index : 'agentName',        width : '100px',sortable:false }, 
						     {name : 'payType',        index : 'payType',        width : '100px',sortable:false ,ditcKey:'PAYTYPE', formatter:gridFormatByDict}, 
						     {name : 'terNo',    hidden : true,    index : 'terNo',        width : '100px',sortable:false }, 
						     {name : 'rateType',        index : 'rateType',        width : '100px',sortable:false ,ditcKey:'RATETYPE', formatter:gridFormatByDict }, 
						     {name : 'rate',        index : 'rate',        width : '100px',sortable:false },
							 {name : 'ordAmt',        index : 'ordAmt',        width : '100px',sortable:false }, 						      
							 {name : 'txAmt',        index : 'txAmt',        width : '100px',sortable:false }, 						      
						     {name : 'fee',        index : 'fee',        width : '80px',sortable:false } ,
						     {name : 'netrecAmt',        index : 'netrecamt',        width : '100px',sortable:false } ,
						     {name : 'payChannel',        index : 'payChannel',        width : '100px',sortable:false } ,
						     {name : 'payCardNo',        index : 'bankpayacno',        width : '100px',sortable:false } ,
						     {name : 'issNam',        index : 'issNam',        width : '100px',sortable:false } ,
						     {name : 'crdNam',        index : 'crdNam',        width : '100px',sortable:false } ,
						     {name : 'modifyTime',        index : 'modifyTime',        width : '140px',sortable:false,formatter : gridFormatByDate} ,
						     {name : 'casStatus',        index : 'casStatus',        width : '70px',sortable:false,ditcKey:'CASSTATUS',formatter:gridFormatByDict} ,
						     {name : 'profitStatus',        index : 'profitStatus',        width : '70px',sortable:false,ditcKey:'PRD_ACC_STATUS' ,formatter : gridFormatByDict} ,
						     {name : 'TCPSCOD', hidden : true,       index : 'TCPSCOD',        width : '80px',sortable:false} ,
						     {name : 'TMERCID',        index : 'TMERCID',        width : '100px',sortable:false} ,
						     {name : 'TLOGNO',  hidden : true,      index : 'TLOGNO',        width : '100px',sortable:false} ,
						     {name : '',        index : '',        width : '100px',sortable:false,formatter:operateEdit} 
			            ],
			viewrecords : true,
			rowNum : 10,
			rowList : [ 10, 20, 30 ],
			altRows : true,

			shrinkToFit : false,
			multiselect : true,//设置行可多选的 
			multiboxonly : true,//
			//postData : $("#rechargeSearchForm").serialize(),

			loadComplete : function() {
				var table = this;
				setTimeout(function() {
					//加载分页
					initPagingBar(grid_selector);
				}, 0);
				var records = jQuery(grid_selector).jqGrid('getGridParam', 'records');
				rowCount = records;
				//刷新成功率显示
				refreshSuccessRate();
			},
			beforeRequest : function() {//请求之前执行
				jqGrid = this;
				var $jqParam = jQuery(grid_selector).jqGrid("getGridParam");
				$.extend($jqParam['postData'],getFormParams("#rechargeSearchForm"));
			},
		});
		$(window).triggerHandler('resize.jqGrid');

		$(document).one('ajaxloadstart.page', function(e) {
			$(grid_selector).jqGrid('GridUnload');
			$('.ui-jqdialog').remove();
		});
	
		
		
	 	function operateEdit(cellvalue, options, rowObject){//定义button按钮
			var button = "<div class=\"hidden-sm hidden-xs btn-group\">";  
				button += "<button class='btn btn-xs btn-warning' onclick='rechargeDetails(\""+rowObject["prdOrdNo"]+"\")'"   
				 +"title='详细信息查看'>详细</button>";
// 				 if(rowObject["payCardNo"] != undefined && rowObject["checkStatus"] != 0 && rowObject["checkStatus"] != 1){
// 					 button += "<button class='btn btn-xs btn-warning' onclick='examineDetails(\""+rowObject["payCardNo"]+"\",\""+rowObject["prdOrdNo"]+"\")'"   
// 					 +"title='审核信息查看'>审核</button>";
// 				 }
			return button;
		};
	});
	
	
	function createDetailsBtn (cellvalue, options, rowObject){
		/* var button = "";  
		button += "<a class='pointer' onclick='rechargeDetails(\""+rowObject["prdOrdNo"]+"\")'"   
		 +"title='"+cellvalue+"'>"+cellvalue+"</a>";
		return button; */
		return cellvalue;
	}
	
	function rechargeDetails(prdOrdNo) {
		 if(prdOrdNo.length<=0){
			msg.alert("警告", "当前没有选择数据项！", "error");
			return;
		}
		 
		var scrWidth = document.body.scrollWidth;
		openDialog({
			dialogId : 'dlg-agentEdit',
			title : '收款订单详情',
			pageUrl :'mpomng/prdInf/rechargeDetailsView.do',
			dataUrl : 'mpomng/prdInf/rechargeDetails.do',
			width : '80%',
		    height:'80%',
			dataParam : {
				prdOrdNo : prdOrdNo
			},
			dataName : 'obj,map'//表单数据存储对象名称

		}); 
		
	}
	
	
	  $(document).ready(function(){
		 searchCount();
	
	 });
	
	function searchCount(){
		// $(document).ready(function(){
			 $.ajax({
					type : "post",
					url : "mpomng/prdInf/rechargeCount.do",
					data:$("#rechargeSearchForm").serialize(),
					dataType : 'json',
					async:true,
					success : function(result) {
						if (result.rspcod != 200) {
							msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
						} else {
							var count=result.obj.cntNum;
							var txamt=result.obj.cntOrdAmt;
							var fee=result.obj.cntFee;
							if(!count){
								count="0";
							}
							if(!txamt){
								txamt="0";
							}
							if(!fee){
								fee="0";
							}
							var html="";
							html+="汇总笔数和金额:["+count+"]笔  |  [" +txamt+ "]元  "
							html+="&nbsp;&nbsp;&nbsp;&nbsp;";
							html+="手续费总额:["+fee+"]元";
							$("#total").html(html);
							
							//刷新成功率显示
							sucCount = count;
							refreshSuccessRate();
						}
					},
					error : function(XMLHttpRequest, textStatus) {
						msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
					}
				});
		

	//});
		
	}
	
	function examineDetails(payCardNo,prdOrdNo) {
		 if(payCardNo.length<=0){
			msg.alert("警告", "当前没有选择数据项！", "error");
			return;
		}
		var scrWidth = document.body.scrollWidth;
		openDialog({
			dialogId : 'dlg-examine',
			title : '审核信息详情',
			pageUrl :'mpomng/prdInf/examineDetailsView.do',
			dataUrl : 'mpomng/prdInf/examineDetails.do',
			width : '80%',
		    height:'80%',
			dataParam : {
				payCardNo : payCardNo,
				prdOrdNo : prdOrdNo
			},
			dataName : 'obj,map'//表单数据存储对象名称

		}); 
		
	}
	
	/**
	*导出交易订单
	*/
	function reportPrdOrdList(){
		var querycon = getFormParams($("#rechargeSearchForm"));
		msg.confirm({title:'确认',position:'center',msg:'为了能够正常导出,请控制查询条件以控制导出数据量!您确定要导出当前数据吗?',call:function(ok){
			if(ok){
				$.ajax({
					type : "post",
					url : 'mpomng/prdInf/report.do',
					dataType : 'json',
					data:querycon,
					success : function(result) {
						if (result.rspcod != 200) {
							msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
						} else {
							msg.alert("提示", result.rspmsg, 'correct');
							$("#grid-table").trigger("reloadGrid");
						}
					},
					error : function(XMLHttpRequest, textStatus) {
						msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
					}
				});
			}
		}});
	}

	function reportData_04(){
		/* var prdOrdNo=$("#prdOrdNo").val();
		var custId=$("#custId").val();
		var custName=$("#custName").val();
		var bankpayacno=$("#bankpayacno").val();
		var search_paystatus=$("#search_paystatus").val();
		var payType=$("#payType").val();
		var prdDateStart=$("#prdDateStart").val();
		var prdDateEnd=$("#prdDateEnd").val(); */
		var querycon = getFormParams($("#rechargeSearchForm"));
		querycon['prdType'] = '02';
		querycon['server'] = '04';
		/* var querycon = {"prdOrdNo":prdOrdNo,
						"custId":custId,
						"custName":custName,
						"payCardNo":bankpayacno,
						"ordStatus":search_paystatus,
						"payType":payType,
						"startTime":prdDateStart,
						"endTime":prdDateEnd,
						"prdType":"02",
						"server":"04"
		}; */
		report(querycon);
	}
	
	function prdOrdSyn() {
		var rows = $('#grid-table').jqGrid("getGridParam", "selarrrow");
		if (rows.length == 0) {
			msg.confirm({title:'确认',position:'center',msg:'您当前未选择订单，将会以您当前的查询条件作为同步依据，请通过条件帅选控制好同步总数量，您确定要进行订单状态同步吗?',call:function(ok){
				if(ok){
					$.ajax({
						type : "post",
						url : 'mpomng/prdInf/prdOrdSyn.do',
						dataType : 'json',
						data:getFormParams($("#rechargeSearchForm")),
						success : function(result) {
							if (result.rspcod != 200) {
								msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
							} else {
								msg.alert("提示", result.rspmsg, 'correct');
								$("#grid-table").trigger("reloadGrid");
							}
						},
						error : function(XMLHttpRequest, textStatus) {
							msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
						}
					});
				}
			}});
		}else{
			var ordNos = "";
			for (var i = 0; i < rows.length; i++) {
				/* if($('#grid-table').jqGrid('getRowData',rows[i]).ordStatus!='清算中'){
					msg.alert("警告", "只能设置清算中的订单！", "warn");
					return;
				} */
				　ordNos += $('#grid-table').jqGrid('getRowData',rows[i]).prdOrdNo + ",";
			}
			ordNos = ordNos.substring(0, ordNos.lastIndexOf(","));
			if(!ordNos){
				alert("您选择的内容无效");
				return;
			}
			var message = "";
			msg.confirm({title:'确认',position:'center',msg:'您确定要进行订单状态同步吗?',call:function(ok){
				if(ok){
					$.ajax({
						type : "post",
						url : 'mpomng/prdInf/prdOrdSyn.do',
						dataType : 'json',
						data:{"prdOrdNos":ordNos},
						success : function(result) {
							if (result.rspcod != 200) {
								msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
							} else {
								msg.alert("提示", result.rspmsg, 'correct');
								$("#grid-table").trigger("reloadGrid");
							}
						},
						error : function(XMLHttpRequest, textStatus) {
							msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
						}
					});
				}
			}});
		}
	}
	
	/**
	*补单
	*/
	function noticeClient(){
		var rows = $('#grid-table').jqGrid("getGridParam", "selarrrow");
		if (rows.length == 0) {
			msg.alert("警告", "当前没有选择数据项！", "warn");
			return;
		}
		var ordNos = "";
		for (var i = 0; i < rows.length; i++) {
			/* if($('#grid-table').jqGrid('getRowData',rows[i]).ordStatus!='清算中'){
				msg.alert("警告", "只能设置清算中的订单！", "warn");
				return;
			} */
			　ordNos += $('#grid-table').jqGrid('getRowData',rows[i]).prdOrdNo + ",";
		}
		ordNos = ordNos.substring(0, ordNos.lastIndexOf(","));
		if(!ordNos){
			alert("您选择的内容无效");
			return;
		}
		var message = "";
		msg.confirm({title:'确认',position:'center',msg:'您确定要进行通知下游客户进行补单操作吗?',call:function(ok){
			if(ok){
				$.ajax({
					type : "post",
					url : 'mpomng/prdInf/prdCallClient.do',
					dataType : 'json',
					data:{"prdOrdNos":ordNos},
					success : function(result) {
						if (result.rspcod != 200) {
							msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
						} else {
							msg.alert("提示", result.rspmsg, 'correct');
							$("#grid-table").trigger("reloadGrid");
						}
					},
					error : function(XMLHttpRequest, textStatus) {
						msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
					}
				});
			}
		}});
	}
	
	/**
	*根据订单发起提现
	*/
	function casByOrder(){
		var rows = $('#grid-table').jqGrid("getGridParam", "selarrrow");
		if (rows.length == 0) {
			msg.alert("警告", "当前没有选择数据项！", "warn");
			return;
		}
		var ordNos = "";
		for (var i = 0; i < rows.length; i++) {
			if($('#grid-table').jqGrid('getRowData',rows[i]).casStatus != '未提现'){
				msg.alert("警告", "只能对未提现的订单申请提现！", "warn");
				return;
			} 
			　ordNos += $('#grid-table').jqGrid('getRowData',rows[i]).prdOrdNo + ",";
		}
		ordNos = ordNos.substring(0, ordNos.lastIndexOf(","));
		if(!ordNos){
			alert("您选择的内容无效");
			return;
		}
		var message = "";
		msg.confirm({title:'确认',position:'center',msg:'注意:申请提现操作只适用于逐笔清算的商户,您确定要申请提现吗?',call:function(ok){
			if(ok){
				$.ajax({
					type : "post",
					url : 'mpomng/prdInf/casByOrder.do',
					dataType : 'json',
					data:{"prdOrdNos":ordNos},
					success : function(result) {
						if (result.rspcod != 200) {
							msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
						} else {
							msg.alert("提示", result.rspmsg, 'correct');
							$(".btn_search").trigger("click");
						}
					},
					error : function(XMLHttpRequest, textStatus) {
						msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
					}
				});
			}
		}});
	}
	
	
	/**
	*退款
	*/
	function refund(){
		var rows = $('#grid-table').jqGrid("getGridParam", "selarrrow");
		if (rows.length == 0) {
			msg.alert("警告", "当前没有选择数据项！", "warn");
			return;
		}
		var ordNos = "";
		for (var i = 0; i < rows.length; i++) {
			/* if($('#grid-table').jqGrid('getRowData',rows[i]).casStatus != '未提现'){
				msg.alert("警告", "只能对未提现的订单申请提现！", "warn");
				return;
			}  */
			　ordNos += $('#grid-table').jqGrid('getRowData',rows[i]).prdOrdNo + ",";
		}
		ordNos = ordNos.substring(0, ordNos.lastIndexOf(","));
		if(!ordNos){
			alert("您选择的内容无效");
			return;
		}
		var message = "";
		msg.confirm({title:'确认',position:'center',msg:'注意:确认退款将会把订单置为退款状态,并从余额中扣除记账金额并无法逆转,您确定要发起退款操作吗?',call:function(ok){
			if(ok){
				$.ajax({
					type : "post",
					url : 'mpomng/prdInf/receivOperation.do',
					dataType : 'json',
					data:{"prdOrdNos":ordNos,"operationType":"1"},
					success : function(result) {
						if (result.rspcod != 200) {
							msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
						} else {
							msg.alert("提示", result.rspmsg, 'correct');
							$(".btn_search").trigger("click");
						}
					},
					error : function(XMLHttpRequest, textStatus) {
						msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
					}
				});
			}
		}});
	}
	
	function resetCountNum(){
		sucCount = null;
		rowCount = null;
	}
	
	//刷新成功率显示
	
	function refreshSuccessRate(){
		if(sucCount == null){
			return;
		}
		if(rowCount == null){
			return;
		}
		var sucRate = 0;
		if(rowCount > 0){
			sucRate = parseFloat(sucCount / rowCount * 100).toFixed(2)
		}
		$("#total").html($("#total").html() + "&nbsp;&nbsp;&nbsp;成功率:[" + sucRate + "]%");
		resetCountNum();
	}
	
	</script>